//
//  BaseTableViewContorller.swift
//  SinaWeiBo
//
//  Created by 有风 on 16/2/16.
//  Copyright © 2016年 YouFeng. All rights reserved.
//

import UIKit

class BaseTableViewContorller: UITableViewController {

    //用户是否登录
    var userLogin = AccountViewModel.sharedAccountViewModel.userLogin
    
    //访客视图属性
    var visitorLoginView : VisitorLoginView?

    
    override func loadView() {
        if userLogin {
            super.loadView()
        }else{
            visitorLoginView = VisitorLoginView()
            
            view = visitorLoginView
            
            navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登录", style: .Plain, target: self, action: "userWillLogin")
            
            navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: "userWillRegist")

        }
    }
    
    func userWillLogin() {
        print(__FUNCTION__)
        let oauth = OAuthViewController()
        let nav = UINavigationController(rootViewController: oauth)
        presentViewController(nav, animated: true, completion: nil)

    }
    
    func userWillRegist() {
        print(__FUNCTION__)
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

}
